package apof.info.RssGroup
{
	import flash.display.Loader;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.events.EventDispatcher;
	import flash.events.Event;
	import mx.controls.Alert;
	import mx.core.Application;
	import flash.filesystem.File;
	import mx.charts.AreaChart;
	import mx.rpc.http.HTTPService;
	
	public class RssGroupGetter extends EventDispatcher
	{
		private var _rssList:Array;
		
		private var _load:URLLoader;
		public function get RssList():Array{
			return _rssList;
		}
		
		public function doGet():void{
			_load = new URLLoader();
			_load.addEventListener(Event.COMPLETE,OnLoadComplete);
			_load.load(new URLRequest(File.applicationResourceDirectory.resolve("apof/info/RssGroup/rssgroup.xml").url));
		}
		
		//加载完成 子类override 此方法
		protected function OnLoadComplete(e:Event):void{
			_rssList = new Array();
			
			var rssXML:XML = XML(_load.data);

			if(rssXML)
			{
				var rssList:XMLList = rssXML.rss.item;
				var item:XML;
				for each(item in rssList){
					var groupitem:RssGroupInfo = new RssGroupInfo();
					groupitem.url = item.@url;
					groupitem.name = item.@name;
					_rssList.push(groupitem);
				}
			}
		
			this.dispatchEvent(new Event(Event.COMPLETE));
		}
		

	}
}